﻿/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef UCOP_UTIL_OPTION_H_
#define UCOP_UTIL_OPTION_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include "Ucop/Typedefs.h"


namespace Ucop {
namespace Util {

    class Option
    {
    public:
        Option(const String& _Name, const String& _ShortName, 
            const String& _Description);
        ~Option(void);

        const String& name(void) const { return _Myname; }
        const String& GetShortName(void) const { return _MyshortName; }
        const String& description(void) const { return _Mydescription; }
        void SetValue(const String& _Value) { _Myvalue = _Value; }
        const String& value(void) const { return _Myvalue; }

        Option& HasArg(bool _Has) { _MyhasArg = _Has; return *this; }
        bool HasArg(void) const { return _MyhasArg; }
        Option IsRequired(bool _Required) { _Myrequired = _Required; return *this; }
        bool IsRequired(void) const { return _Myrequired; }
        void SetValid(bool _Valid) { _Myvalid = _Valid; }
        bool IsValid(void) const { return _Myvalid; }

        bool MatchName(const String& _Name);
        bool MatchShortName(const String& _ShortName);
    
    private:
        String _Myname;
        String _MyshortName;
        String _Mydescription;
        String _Myvalue;
        bool _MyhasArg;
        bool _Myrequired;
        bool _Myvalid;
    };

}}

#endif // UCOP_UTIL_OPTION_H_
